package system

import (
	"fitness/internal/entity"
	"time"
)

type SysUser struct {
	entity.Model
	UserName *string `json:"userName" gorm:"column:username"`
	NickName *string `json:"nikeName" gorm:"column:nickname"`
	Gender   *string `json:"gender" gorm:"column:gender"`
	Password *string `json:"password"`
	DeptId   *uint64 `json:"deptId" gorm:"column:dept_id"`
	Avatar   *string `json:"avatar" gorm:"column:avatar"`
	Mobile   *string `json:"mobile" gorm:"column:mobile"`
	Status   *uint8  `json:"status"` //状态((1-正常 0-禁用)
	Email    *string `json:"email" gorm:"column:email"`
	UserType *string `json:"userType" gorm:"column:user_type"` //用户类别 0 总后台 1 代理 2租户
}

func (SysUser) TableName() string {
	return "sys_user"
}

type UserOption struct {
	ID       uint64 `json:"id" gorm:"column:id"`
	UserName string `json:"username" gorm:"column:username"`
	UserType uint8  `json:"userType" gorm:"column:user_type"` //用户类别 0 总后台 1 代理 2租户
}

// 用户列表类
type UserPageVO struct {
	ID         uint64 `json:"id"`
	UserName   string `json:"username" `
	NickName   string `json:"nickname"`
	Mobile     string `json:"mobile" `
	Gender     string `json:"gender" gorm:"gender"`
	Avatar     string `json:"avatar"`
	Email      string `json:"email"`
	Status     uint8  `json:"status"`
	DeptName   string `json:"deptName"`
	UserType   uint8  `json:"userType" gorm:"column:user_type"` //用户类别 0 总后台 1 代理 2租户
	RoleNames  string `json:"roleNames"`
	CreateTime string `json:"createTime"`
}

type UserBO struct {
	ID         uint64    `gorm:"primary_key" json:"id"`
	UserName   string    `json:"userName" gorm:"column:username"`
	NickName   string    `json:"nikeName" gorm:"column:nickname"`
	Mobile     string    `json:"mobile" gorm:"mobile"`
	Gender     string    `json:"gender" gorm:"gender"`
	Avatar     string    `json:"avatar" gorm:"avatar"`
	Email      string    `json:"email" gorm:"email"`
	Status     uint8     `json:"status" gorm:"status"`
	DeptName   string    `json:"deptName"  gorm:"dept_name"`
	RoleNames  string    `json:"roleNames"  gorm:"role_names"`
	UserType   uint8     `json:"userType" gorm:"column:user_type"` //用户类别 0 总后台 1 代理 2租户
	CreateTime time.Time `json:"createTime" gorm:"column:create_time;type:datetime"`
}

type SysUserPageQuery struct {
	PageQuery entity.PageQuery
	Status    *uint8  `form:"status"`
	DeptId    *uint64 `form:"deptId"`
	StartTime *string `form:"startTime"`
	EndTime   *string `form:"endTime"`
}

type UserForm struct {
	ID           *uint64   `json:"id" gorm:"primary_key"`
	UserName     *string   `json:"username" gorm:"column:username"`
	NickName     *string   `json:"nickname" gorm:"column:nickname"`
	Mobile       *string   `json:"mobile" gorm:"mobile"`
	Gender       *string   `json:"gender" gorm:"column:gender"`
	Avatar       *string   `json:"avatar" gorm:"avatar"`
	Email        *string   `json:"email" gorm:"column:email"`
	Status       *uint8    `json:"status" gorm:"status"`
	DeptId       *uint64   `json:"deptId" gorm:"dept_id"`
	CustomerType *uint8    `json:"customerType" gorm:"column:customer_type"` //用户类别 1 管理 2坐席
	RoleIds      []*uint64 `json:"roleIds"`
}

type UpdatePwd struct {
	OldPassword string `form:"oldPassword"`
	NewPassword string `form:"newPassword"`
}

type UpdateProfile struct {
	Nickname *string `json:"nickname" form:"nickname" binding:"omitempty,gt=0,lte=50" label:"昵称"`
}
